package com.dong.designPattern.strategy;

import com.dong.designPattern.strategy.abs.TravelStrategy;
import com.dong.designPattern.strategy.concrete.AirPlaneStrategy;
import com.dong.designPattern.strategy.concrete.BicyleStrategy;
import com.dong.designPattern.strategy.concrete.TrainStrategy;
import org.junit.Test;

public class StrategyTest {

    @Test
    public void test() {
        TravelStrategy strategy = new AirPlaneStrategy();
        PersonContext person = new PersonContext(strategy);
        person.travel();

        strategy = new TrainStrategy();
        person.setStrategy(strategy);
        person.travel();

        strategy = new BicyleStrategy();
        person.setStrategy(strategy);
        person.travel();
    }
}
